package gsi

type SystemInfo struct {
	OS      *OS      `json:"os"`
	CPU     *CPU     `json:"cpu"`
	Memory  *Memory  `json:"memory"`
	Network *Network `json:"network"`
}

func GetSystemInfo() (*SystemInfo, error) {
	sysinfo := &SystemInfo{
		OS:      &OS{},
		CPU:     &CPU{},
		Memory:  &Memory{},
		Network: &Network{},
	}
	sysinfo.OS.getOSInfo()
	sysinfo.CPU.getCPUInfo()
	sysinfo.Memory.getMemoryInfo()
	sysinfo.Network.getNetworkInfo()

	return sysinfo, nil
}

// YAMLString returns a string with the host information formatted as YAML
// under a top-level "host:" key
func (i *SystemInfo) YAMLString() string {
	return SafeYAML(i)
}

// JSONString returns a string with the host information formatted as JSON
// under a top-level "host:" key
func (i *SystemInfo) JSONString(indent bool) string {
	return SafeJSON(i, indent)
}
